<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <title>员工管理系统</title>
    <link href="${pageContext.request.contextPath}/static/css/bootstrap.min.css" rel="stylesheet">
    <link href="${pageContext.request.contextPath}/static/css/main.css" rel="stylesheet">
    <script src="${pageContext.request.contextPath}/static/js/jquery-3.6.0.js"></script>
    <script src="${pageContext.request.contextPath}/static/js/bootstrap.min.js"></script>
</head>
<body>
<nav class="navbar navbar-dark sticky-top bg-info flex-md-nowrap p-0">
    <span class="navbar-brand col-sm-3 col-md-2  mr-0" href="#">
        <img src="${pageContext.request.contextPath}/static/img/1.svg" width="25px" height="22px" style="margin-bottom: 4px" alt="">
        &nbsp;&nbsp;${pageContext.session.getAttribute("Name")}
    </span>
    <input class="form-control form-control-dark w-100" type="text" placeholder="Search" aria-label="Search">
    <ul class="navbar-nav px-3">
        <li class="nav-item text-nowrap">
            <a class="nav-link" href="/logout">登出</a>
        </li>
    </ul>
</nav>
<div class="container-fluid">
    <div class="row">
        <nav class="col-md-2 d-none d-md-block bg-light sidebar">
            <div class="sidebar-sticky">
                <ul class="nav flex-column">
                    <li class="nav-item">
                        <a class="nav-link active" href="/myInfo/${pageContext.session.getAttribute("Eid")}">
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-home">
                                <path d="M3 9l9-7 9 7v11a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2z"></path>
                                <polyline points="9 22 9 12 15 12 15 22"></polyline>
                            </svg>
                            个人信息
                        </a>
                    </li>
                    <c:if test="${pageContext.session.getAttribute('Role')=='管理员'}">
                        <li class="nav-item">
                            <a class="nav-link" href="/toMain">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-users">
                                    <path d="M17 21v-2a4 4 0 0 0-4-4H5a4 4 0 0 0-4 4v2"></path>
                                    <circle cx="9" cy="7" r="4"></circle>
                                    <path d="M23 21v-2a4 4 0 0 0-3-3.87"></path>
                                    <path d="M16 3.13a4 4 0 0 1 0 7.75"></path>
                                </svg>
                                员工信息
                            </a>
                        </li>
                    </c:if>
                    <c:if test="${pageContext.session.getAttribute('Role')=='管理员'}">
                        <li class="nav-item">
                            <a class="nav-link" href="/attendance">
                                <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-file-text">
                                    <path d="M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z"></path>
                                    <polyline points="14 2 14 8 20 8"></polyline>
                                    <line x1="16" y1="13" x2="8" y2="13"></line>
                                    <line x1="16" y1="17" x2="8" y2="17"></line>
                                    <polyline points="10 9 9 9 8 9"></polyline>
                                </svg>
                                员工出勤
                            </a>
                        </li>
                    </c:if>
                </ul>
            </div>
        </nav>
        <main role="main" class="col-md-9 ml-sm-auto col-lg-10 pt-3 px-4">
            <h2 style="border-bottom:3px solid #a0a4a0;margin-bottom: 30px;padding-left:450px">员工出勤管理</h2>
            <div class="table-responsive">
                <table class="table table-striped table-sm">
                    <thead>
                    <tr>
                        <th>工号</th>
                        <th>姓名</th>
                        <th>部门</th>
                        <th>上班打卡</th>
                        <th>下班打卡</th>
                        <th>工时</th>
                        <th>联系方式</th>
                        <th>删除</th>
                    </tr>
                    </thead>
                    <tbody style="line-height: 30px">
                    <c:forEach var="attendance" items="${attendances}">
                        <tr>
                            <td>${attendance.eid}</td>
                            <td>${attendance.employee.name}</td>
                            <td>${attendance.employee.department}</td>
                            <c:if test="${attendance.workDate=='0'}">
                                <div hidden>${attendance.workDate='未打卡'}</div>
                            </c:if>
                            <c:if test="${attendance.offDate=='0'}">
                                <div hidden>${attendance.offDate='未打卡'}</div>
                            </c:if>
                            <td>${attendance.workDate}</td>
                            <td>${attendance.offDate}</td>
                            <td>${attendance.working}</td>
                            <td>${attendance.employee.phone}</td>
                            <td>
                                <a class="btn btn-danger btn-sm" href="/deleteAttendance/${attendance.eid}">删除</a>
                            </td>
                        </tr>
                    </c:forEach>
                    </tbody>
                </table>
            </div>
        </main>
    </div>
</div>
</body>
</html>
